其他
不懂就问:SQL 语句中 where 条件后 写上1=1 是什么意思
The following article is from SQL数据库开发 Author 丶平凡世界
关注上方“Python数据科学”,选择星标,
关键时间,第一时间送达!
与
select * from customers where 1=1;
if( condition 1) {
sql=sql+" and var2=value2";
}
if(condition 2) {
sql=sql+" and var3=value3";
}
if( condition 1) {
sql=sql+" where var2=value2 ";
}
if(condition 2) {
sql=sql+" where var3=value3";
}
where var2=value2
where var3=value3;
as
select * from Source_table
where 1=1;
as
select * from
Source_table where 1 <> 1;